﻿using System;
using System.Collections.Generic;
using System.Web;
using CnGine.Web;
using System.Data;

/// <summary>
///Base 的摘要说明
/// </summary>
public class Base : PageBase
{
    public int pageIndex = 0;

    public int TypeID = 0;
    public int ColorID = 0;
    public int Language = 0;

    public Base()
    {
        this.PreInit += new EventHandler(Base_PreInit);
    }

    void Base_PreInit(object sender, EventArgs e)
    {
        pageIndex = base.QueryInt32("page");
        if (pageIndex == 0) pageIndex = 1;
        //
        TypeID = base.QueryInt32("type");
        ColorID = base.QueryInt32("color");
        Language = base.QueryInt32("lang");
    }

    public string GetUserLink(object o)
    {
        int userid = base.ParseInt32(o);
        return string.Format("#{0}", userid);
    }

    public string GetLanguage(int id)
    {
        DataSet ds = Comm.PublicType.getLanguage();
        if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
        {
            DataRow[] rows = ds.Tables[0].Select(" id=" + id.ToString());
            if (rows.Length > 0) return rows[0]["namekey"].ToString();
        }
        return "";
    }

}